package com.SouthernWall_404.AgeRight.Common;


import com.SouthernWall_404.AgeRight.Common.Init.ModCapability;
import com.SouthernWall_404.AgeRight.Common.Init.ModCreativeModeTab;
import com.SouthernWall_404.AgeRight.Common.Init.ModItems;
import com.SouthernWall_404.AgeRight.Common.Event.*;
//import com.SouthernWall_404.AgeRight.Common.Event.LockableBlocksEventHandler;
import com.SouthernWall_404.AgeRight.Common.Init.ModLockableBlocks;
import com.SouthernWall_404.AgeRight.Common.Network.ModChannels;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;

// The value here should match an entry in the META-INF/mods.toml file
@Mod(AgeRight.MODID)
public class AgeRight
{
    // Define mod id in a common place for everything to reference
    public static final String MODID = "age_right";

    public AgeRight()
    {
        LockableBlocksEventHandler.setup();

        IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
        modEventBus.addListener(this::registerChannel);

        ModItems.ITEMS.register(modEventBus);
        ModCreativeModeTab.CREATIVE_TABS.register(modEventBus);

        MinecraftForge.EVENT_BUS.register(onRightClick.class);
        MinecraftForge.EVENT_BUS.register(onLeftClick.class);
        MinecraftForge.EVENT_BUS.register(AttachCapabilityEvent.class);
        MinecraftForge.EVENT_BUS.register(ChunkEvents.class);
        MinecraftForge.EVENT_BUS.register(MissionEventHandler.class);
        MinecraftForge.EVENT_BUS.register(KillEventHandler.class);
//        MinecraftForge.EVENT_BUS.register(ModLockableBlocks.class);

        modEventBus.register(ModLockableBlocks.class);
        modEventBus.addListener(ModCapability::onCapabilityRegister);

    }

    private void registerChannel(FMLCommonSetupEvent event)
    {
        ModChannels.register();
    }
}
